Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Functional map with sugar.
npm:
npm install mapz
var mapz = require('mapz')
var map = mapz(fn, {key: 'children', gapless: true})
map({children: [1, 2, 3]}) // => ['Hi, 2', 'Hi, 3']
function fn(value) {
return value > 1 ? 'Hi, ' + value + '.' : null
}
mapz(fn[, options])
Functional map with sugar (functional, as values are provided as a parameter, instead of context object).
Wraps the supplied fn
, which handles one value, so that it accepts
multiple values, invoking fn
for each and returning all results.
If options
is a string, it’s treated as {key: options}
.
options.gapless
Whether to filter out null
and undefined
results (boolean
, default:
false
).
options.indices
Whether to invoke fn
with the index of the value in its context (boolean
,
default: true
);
options.key
If a key (string
, optional) is given, and an object supplied to the wrapped
fn
, values at that object’s key
property are mapped and the object, instead
of the values, is given to fn
as a last parameter.
If a key is given and an array is passed to the wrapped fn
, no value is given
to fn
as a last parameter.
Function
— See map(values)
map(values)
Invoke the bound fn
for all values. If a key
is bound, values
can
be an object.
See options.key
for more info.
Array.<*>
— Values returned by fn
. If gapless
is true
, null
or
undefined
results are not returned by map
.
fn(value[, index], parent?)
Handle one value.
If indices
is false
, no index parameter is passed.
If key
is set and an array is given, no parent
is passed.
*
— Any value.
zwitch
— Handle values based on a propertyFAQs
Functional map with sugar
The npm package mapz receives a total of 633 weekly downloads. As such, mapz popularity was classified as not popular.
We found that mapz demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.